<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新闻管理</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="lib/angular.js"></script>
    <script src="lib/av.js"></script>
    <script src="news.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
</head>
<body ng-app="newsModule">
<nav class="navbar navbar-inverse" role="navigation">
    <div class="navbar-header">
        <a class="navbar-brand" href="#">二手车交易</a>
    </div>
    <div>
        <ul class="nav navbar-nav">
            <li class="active"><a href="#">新闻管理</a></li>
            <li><a href="carAudit.html">卖车审核</a></li>
            <li><a href="carSoldAudit.html">已交易二手车审核</a></li>
            <li><a href="login.html">退出登录</a></li>
        </ul>
    </div>
</nav>
<div class="container" ng-controller="newsCtrl">


    <div>
        <h1>二手车交易管理系统后台</h1>

        <div>
            <h3>新闻管理</h3>
        </div>
        <table class="table table-bordered">
            <thead>
            <tr>
                <th>
                    编辑
                </th>
                <th>
                    删除
                </th>
                <th>
                    图片地址
                </th>
                <th>
                    新闻标题
                </th>


            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="todo in news">
                <td>
                    <button data-toggle="modal" ng-click="editTemp(todo)"
                            data-target="#myModal"  class="btn btn-info">编辑</button>
                </td>
                <td>
                    <button ng-click="deleteItem(todo)" class="btn btn-danger">删除</button>
                </td>
                <td>
                    <img src="{{todo.image_url}}" >
                </td>
                <td>
                    <a href=" {{todo.news_url}}">{{todo.news_desc}}</a>
                </td>
            </tr>

            </tbody>


        </table>
    </div>
    <hr>
    <div class="table-bordered">
        <h3>创建 新闻资讯</h3>

        <form ng-submit="addItem()">
            <div class="form-group">
                <label for="input_title">名称</label>
                <input type="text" class="form-control" id="input_title"
                       placeholder="请输入名称" ng-model="newItem.news_desc">
            </div>
            <div class="form-group">
                <label for="input_url">资讯URL输入</label>
                <input type="text" id="input_url" ng-model="newItem.news_url">

                <p class="help-block">输入具体的访问地址如：http://www.baidu.com</p>
            </div>
            <div class="form-group">
                <label for="input_image">新闻图片地址</label>
                <input type="text" id="input_image" ng-model="newItem.image_url">

                <p class="help-block">输入具体的访问地址如：http://www.baidu.com</p>
            </div>
            <button type="submit" class="btn btn-info">提交</button>
            <hr>
        </form>
    </div>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        模态框（Modal）标题
                    </h4>
                </div>
                <div class="modal-body">
                    <form ng-submit="editItem()">
                        <div class="form-group">
                            <label for="input_model_title">名称</label>
                            <input type="text" class="form-control" id="input_model_title"
                                   placeholder="请输入名称" ng-model="editTempItem.news_desc">
                        </div>
                        <div class="form-group">
                            <label for="input_model_url">资讯URL输入</label>
                            <input type="text" id="input_model_url" ng-model="editTempItem.news_url">

                            <p class="help-block">输入具体的访问地址如：http://www.baidu.com</p>
                        </div>
                        <div class="form-group">
                            <label for="input_model_image">新闻图片地址</label>
                            <input type="text" id="input_model_image" ng-model="editTempItem.image_url">

                            <p class="help-block">输入具体的访问地址如：http://www.baidu.com</p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default"
                                    data-dismiss="modal">关闭
                            </button>
                            <button type="submit" class="btn btn-info">提交</button>
                        </div>
                    </form>
                </div>

            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
</body>
</html>
